/**
 * Created by Richard Radlherr.
 * Date: 24.06.2006 21:13
 */

using System;
using TagTool.GraphicTypes;
using TagTool.Core;

namespace TagTool.Nodes.Graphic
{ 

	public class ColorGenerator : BaseNode
	{
		private InputSlot a;
		private InputSlot r;
		private InputSlot g;
		private InputSlot b;
		private OutputSlot color;
		
		public ColorGenerator() : base()
		{
			Name = "Color";
			
			a = new InputSlot(this, "Alpha", 1.0);
			a.ParseCallback = ParseHelper.ParseDouble;
			
			r = new InputSlot(this, "Red", 1.0);
			r.ParseCallback = ParseHelper.ParseDouble;
			
			g = new InputSlot(this, "Green", 1.0);
			g.ParseCallback = ParseHelper.ParseDouble;
			
			b = new InputSlot(this, "Blue", 1.0);
			b.ParseCallback = ParseHelper.ParseDouble;
	
			color = new OutputSlot(this, "Color", typeof(Color));
			color.Value = new Color(1.0, 1.0, 1.0, 1.0);
		}
		
		public override void Update(Object sender)
		{
			color.Value = new Color((double)a.Value, (double)r.Value, (double)g.Value, (double)b.Value);
			CastTrigger();
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot A
		{
			get { return a; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot R
		{
			get { return r; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot G
		{
			get { return g; }
		}
		
		[NodeAttribute(SlotType.Input, Show = true)]
		public InputSlot B
		{
			get { return b; }
		}

		[NodeAttribute(SlotType.Output, Show = true)]
		public OutputSlot Color
		{
			get { return color; }
		}
		
	}
}
